home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / Draw / Sources / Content.h < prev    next >
Encoding:
Text File  |  1996-04-25  |  4.7 KB  |  159 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                Content.h
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef CONTENT_H
  11. #define CONTENT_H
  12.  
  13. // ----- FrameWork Includes -----
  14.  
  15. #ifndef FWCONTNG_H
  16. #include "FWContng.h"
  17. #endif
  18.  
  19. #ifndef FWSCPTBL_H
  20. #include "FWScptbl.h"
  21. #endif
  22.  
  23. #ifndef BASESHP_H
  24. #include "BaseShp.h"
  25. #endif
  26.  
  27. //========================================================================================
  28. //    Forward Declarations
  29. //========================================================================================
  30.  
  31. class CDrawPart;
  32. class CShapeCollection;
  33. class CProxyShape;
  34.  
  35. //========================================================================================
  36. //    class CDrawContent
  37. //========================================================================================
  38.  
  39. class CDrawContent : public FW_CEmbeddingContent
  40. {
  41. public:
  42.     friend class CDrawContentShapeIterator;
  43.     friend class CSemanticShapeElementIterator;
  44.     friend class CAllShapeIterator;
  45.     
  46. //----------------------------------------------------------------------------------------
  47. //    Initialization/Destruction
  48. //
  49.   public:
  50.     FW_DECLARE_AUTO(CDrawContent)
  51.     
  52.     CDrawContent(Environment* ev, CDrawPart* part);
  53.     CDrawContent(Environment* ev, CDrawContent* other);
  54.  
  55.     virtual ~CDrawContent();
  56.  
  57. //----------------------------------------------------------------------------------------
  58. //    Inherited API
  59. //
  60.   public:
  61.     virtual FW_MProxy*    IsDataOnlyOneProxy(Environment* ev) const;
  62.  
  63. //----------------------------------------------------------------------------------------
  64. //    Overridable API
  65. //
  66.   public:
  67.     virtual FW_Boolean    IsOKtoWrite(Environment* ev, CBaseShape* shape);
  68.     virtual void        PostInternalizeShape(Environment* ev, const FW_CPoint& offset, CBaseShape* shape, short index);
  69.  
  70. //----------------------------------------------------------------------------------------
  71. //    New API
  72. //
  73.   public:
  74.     CProxyShape*        AddSingleEmbeddedFrame(Environment* ev,
  75.                                         FW_CEmbeddingFrame* scopeFrame,
  76.                                         ODPart* odEmbeddedPart, 
  77.                                         ODFrame* odEmbeddedFrame,
  78.                                         ODShape* suggestedShape,
  79.                                         ODTypeToken viewType);
  80.  
  81.     void                ExternalizeShapeList(Environment* ev,
  82.                                         ODStorageUnit* storageUnit, 
  83.                                         FW_CCloneInfo* cloneInfo,
  84.                                         FW_Fixed offsetX,
  85.                                         FW_Fixed offsetY);
  86.     void                InternalizeShapeList(Environment* ev,
  87.                                             ODStorageUnit* storageUnit, 
  88.                                             FW_CCloneInfo* cloneInfo);
  89.  
  90.  
  91.     void                AddShape(Environment* ev, CBaseShape* shape, CBaseShape* nextShape=NULL);
  92.     void                RemoveShape(Environment* ev, CBaseShape* shape);
  93.  
  94.     void                EmptyShapes(Environment* ev);
  95.  
  96.     ODShape*            CalcUpdateShape(Environment* ev);
  97.     void                OffsetShapes(Environment* ev, const FW_CPoint& offset);
  98.     void                RedrawShapes(Environment* ev);
  99.     void                RedrawShape(Environment* ev, CBaseShape* shape);
  100.     void                RedrawShape(Environment* ev, ODShape* odShape);
  101.  
  102. //----------------------------------------------------------------------------------------
  103. //    Getters & Setters
  104. //
  105.   public:
  106.     unsigned long        CountShapes() const;
  107.     FW_Boolean            IsEmpty() const;
  108.  
  109.     CBaseShape*            GetFirstShape() const;
  110.     CBaseShape*            GetShapeAfter(CBaseShape* shape) const;
  111.  
  112.     unsigned short        GetProxyShapeCount() const
  113.                             {return fProxyShapeCount;}
  114.     
  115. //----------------------------------------------------------------------------------------
  116. //    Data Members
  117. //
  118.   protected:
  119.     CShapeCollection*    fShapeList;    // list of CBaseShape*
  120.     CDrawPart*            fDrawPart;
  121.     unsigned short         fProxyShapeCount;
  122. };
  123.  
  124. //========================================================================================
  125. //    class CDrawContentShapeIterator
  126. //========================================================================================
  127.  
  128. class CDrawContentShapeIterator : public CShapeCollectionIterator
  129. {
  130. public:
  131.     FW_DECLARE_AUTO(CDrawContentShapeIterator)
  132.  
  133. public:
  134.     CDrawContentShapeIterator(CDrawContent* content);
  135.     ~CDrawContentShapeIterator();
  136. };
  137.  
  138. //========================================================================================
  139. //    class CSemanticShapeElementIterator
  140. //========================================================================================
  141.  
  142. class CSemanticShapeElementIterator : public FW_CElementIterator
  143. {
  144. public:
  145.     FW_DECLARE_AUTO(CSemanticShapeElementIterator)
  146.     
  147.     CSemanticShapeElementIterator(CDrawContent* content);
  148.     ~CSemanticShapeElementIterator();
  149.     
  150.     virtual FW_MScriptable* First() { return fImplementation.First(); }
  151.     virtual FW_MScriptable* Next()    { return fImplementation.Next();  }
  152.     virtual Boolean IsNotComplete()    { return fImplementation.IsNotComplete(); }
  153.     
  154. private:
  155.     CShapeCollectionIterator fImplementation;
  156. };
  157.  
  158. #endif
  159.